<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../language.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><fmt:message key="i18n.userCenter"/>-<fmt:message key="i18n.title"/></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<script type="text/javascript" src="../scripts/user/common.js"></script>
<script type="text/javascript" src="../scripts/user/reguser.js"></script>
<script type="text/javascript">
function setLanguage(lang) {
	setCookie('language', lang, 300);
	window.top.location.reload();
}
function logout() {
	if (confirm("确定退出吗?")) {
		window.top.location.href = 'logout.jsp';
	}
}
function setCookie(c_name, value, exdays) {

	var exdate = new Date();
	exdate.setDate(exdate.getDate() + exdays);
	var c_value = escape(value)
			+ ((exdays == null) ? "" : "; expires="
					+ exdate.toUTCString());
	document.cookie = c_name + "=" + c_value;
}
	
</script>
<%
session.setAttribute("end", "完善信息");
session.setAttribute("middle", "个人管理");
%>
<jsp:include page="common.jsp"></jsp:include>
</head>
<body>
<jsp:include page="page_head.jsp"></jsp:include>
	
	<div class="row">
		<div class="col-md-12">
			<div class="box border primary">
				<div class="box-title">
					<h4><i class="fa fa-bars"></i>完善信息</h4>
				</div>
				<div class="box-body big">
					<h3 class="form-title">您的资料尚未完善，请先完善后进行再其他操作</h3>
					<form class="form-horizontal" role="form" action="registerUser!saveRegisterInfo.action" method="post" id="registerInfo_form">
						<input type="hidden" name="registerUserDTO.loginName" value="${loginName}" />
     				 <div class="form-group">
						<label class="col-sm-3 control-label"><i style="color: red;">*</i><fmt:message key="i18n.userRegAccount"/>：</label>
						<div class="col-sm-5">
						  <input type="text" class="form-control" type="text" value="${loginName }" id="reg_loginName" readonly="readonly" >
						</div>
						<label class="col-sm-4 control-label">
						</label>
					  </div>
					   <div class="form-group">
							<label class="col-sm-3 control-label"><i style="color: red;">*</i><fmt:message key="i18n.userlevel"/>：</label>
							<div class="col-sm-5">
							 <select class="form-control" name="registerUserDTO.registerLevel">
							    <option value="L1"><fmt:message key="L1" />(500)</option>
	   							<option value="L2"><fmt:message key="L2" />(2000)</option>
	   							<option value="L3"><fmt:message key="L3" />(5000)</option>
	   							<option value="L4"><fmt:message key="L4" />(10000)</option>
	   							<option value="L5"><fmt:message key="L5" />(20000)</option>
	   							<%-- <option value="L6"><fmt:message key="L6" />(不可购买)</option> --%>
	   							<%--<option value="L7"><fmt:message key="L7" /></option>
	   							<option value="L8"><fmt:message key="L8" /></option> --%>
							</select>
						  </div>
						<label class="col-sm-4 control-label">
						</label>
					  </div>
					   <div class="form-group">
						<label class="col-sm-3 control-label"><i style="color: red;">*</i><fmt:message key="i18n.piUserName"/>：</label>
						<div class="col-sm-5">
						  <input type="text"  value="${userEntity.userName }" name="registerUserDTO.userName" id="reg_userName" class="form-control" >
						</div>
						<label class="col-sm-4 control-label">
							<fmt:message key="i18n.userNameAndBankNameTips"/>
						</label>
					  </div>
					   <div class="form-group">
						<label class="col-sm-3 control-label"><i style="color: red;">*</i><fmt:message key="i18n.send2Password"/>：</label>
						<div class="col-sm-5">
						  <input class="form-control" type="password" value="" id="reg_password2" name="registerUserDTO.password2" />
						</div>
						<label class="col-sm-4 control-label">
						</label>
					  </div>
					  <div class="form-group">
						<label class="col-sm-3 control-label"><i style="color: red;">*</i><fmt:message key="i18n.cofimsend2Password"/>：</label>
						<div class="col-sm-5">
						  <input class="form-control" type="password" value="" id="reg_conf_password2" />
						</div>
						<label class="col-sm-4 control-label">
						</label>
					  </div>
					   <div class="form-group">
						<label class="col-sm-3 control-label"><span id="showContactNoList"></span><i style="color: red;">*</i><fmt:message key="i18n.recommendUser"/>：</label>
						<div class="col-sm-5">
						  <input class="form-control" type="text" name="registerUserDTO.recommendUser" 
            			id="reg_recommendUser" value="${userEntity.recommendUser }" 
            			<c:if test="${not empty userEntity.recommendUser}"> readonly="readonly" </c:if>
            			onBlur="findUserNameByLoginName(this.value,'reg_show_recommendUser')" />
						</div>
						<label class="col-sm-4 control-label" id="reg_show_recommendUser">&nbsp;</label>
					  </div>
					  
					   <div class="form-group">
						<label class="col-sm-3 control-label"><fmt:message key="position"/>：</label>
						<div class="col-sm-5">
							<fmt:message key="i18n.left" />：<input type="radio" name="registerUserDTO.registerLocation1" id="registerLocation_aArea"  checked="checked" value="aArea" />
							<fmt:message key="i18n.right" />：<input type="radio" name="registerUserDTO.registerLocation1" id="registerLocation_bArea"  <c:if test="${userEntity.registerLocation eq 'bArea' }"> checked="checked" </c:if> value="bArea" />
							<input type="hidden" name="registerUserDTO.registerLocation" id="registerLocation" value="aArea" />
						</div>
						<label class="col-sm-4 control-label"></label>
					  </div>
				
					  <div class="form-group">
						<label class="col-sm-3 control-label"><i style="color: red;">*</i><fmt:message key="contactuser"/>：</label>
						<div class="col-sm-4">
						 <input type="text" class="form-control" name="registerUserDTO.contactNo" 
            			<c:if test="${not empty userEntity.contactNo}"> readonly="readonly" </c:if>
            			id="reg_contactNo" value="${userEntity.contactNo}" onBlur="findUserNameByLoginName(this.value,'reg_show_contactNo')" />
            			</div>
						<div class="col-sm-5 control-label">
							<label class="tip tipText" id="reg_show_contactNo">&nbsp;</label>
	            			<button class="btn btn-info" type="button" onclick="findcontact('reg_recommendUser')" ><fmt:message key="sysAutoFindContact" /></button>
	                        <button class="btn btn-info" type="button" onclick="findcontact1('reg_recommendUser')" >接点人(移动版)</button>
						</div>
					  </div>
					   <div class="form-group">
						<label class="col-sm-3 control-label"><i style="color: red;">*</i><fmt:message key="i18n.bdCenter"/>：</label>
						<div class="col-sm-5">
						  <input class="form-control" type="text" name="registerUserDTO.declarationCenters"  value="${userEntity.declarationCenters}" id="reg_declarationCenters" 
            			onBlur="findUserNameByLoginName(this.value,'reg_show_userName')">&nbsp;
						</div>
						<label class="col-sm-4 control-label"  id="reg_show_userName">
						</label>
					  </div>
					  <div class="form-group">
							<label class="col-sm-3 control-label"><i style="color: red;">*</i><fmt:message key="i18n.openUserBank"/>：</label>
							<div class="col-sm-5">
							 <select class="form-control" id="accountType" name="registerUserDTO.accountType">
							   <%-- <option value="">--<fmt:message key="i18n.pelaseSelect"/>--</option> --%>
								<option value="中国农业银行"><fmt:message key="i18n.abcBank"/></option>
								<option value="中国工商银行"><fmt:message key="i18n.gongBank"/></option>
								<option value="中国建设银行"><fmt:message key="i18n.ccbBank"/></option>
								<option value="中国银行"><fmt:message key="i18n.chinaBank"/></option>
								<option value="财付通"><fmt:message key="i18n.caifutong"/></option>
								<option value="支付宝">支付宝</option>
							</select>
						  </div>
						<label class="col-sm-4 control-label">
						</label>
					  </div>
					    <div class="form-group">
						<label class="col-sm-3 control-label"><i style="color: red;">*</i><fmt:message key="i18n.piBrankAccount"/>：</label>
						<div class="col-sm-5">
						  <input type="text" id="reg_bankAccount" value="${userEntity.bankAccount }" name="registerUserDTO.bankAccount" class="form-control" />
						</div>
						<label class="col-sm-4 control-label">
						</label>
					  </div>
					   <div class="form-group">
						<label class="col-sm-3 control-label"><i style="color: red;">*</i><fmt:message key="i18n.openBankAddress"/>：</label>
						<div class="col-sm-5">
						  <input type="text" value="${userEntity.openBankAddress }" id="openBankAddress" name="registerUserDTO.openBankAddress" class="form-control" /">
						</div>
						<label class="col-sm-4 control-label">
						</label>
					  </div>
					  <div class="form-group">
						<label class="col-sm-3 control-label"><i style="color: red;">*</i><fmt:message key="i18n.piMobile"/>：</label>
						<div class="col-sm-5">
						 	<input id="reg_phone" class="form-control" type="text" readonly="readonly" value="${userEntity.mobile }" name="registerUserDTO.mobile" />
						</div>
						<div class="col-sm-4">
						</div>
					  </div>
					   <div class="form-group">
						<label class="col-sm-3 control-label"></label>
						<div class="col-sm-5">
							<input type="hidden" id="cp_loginUserMobile" name="rubDTO.mobile" value="${rubDTO.mobile}" />
						  <button class="btn btn-primary form-control" type="button" id="btnSubmitInfo" ><fmt:message key="i18n.save"/></button>
						</div>
						<label class="col-sm-4 control-label">
						</label>
					  </div>
					 </form>
				</div>
			</div>
		</div>
	</div>
	
<jsp:include page="page_foot.jsp"></jsp:include>
<script type="text/javascript">
$(function(){
	//$('#registerMainContent').css("margin-left","200px");
	var problem = "${userEntity.passwordProblem}";
	var bank = "${userEntity.accountType}";
	//$('#accountType').val(bank);
	//$('#regInfoProblem').val(problem);
	//$('#reg_registerLocation').val('${param.registerLocation}');
	//randomNo('reg_loginName');
	document.onkeydown = function(evt){
		var evt = window.event?window.event:evt;
		if(evt.keyCode==13){
			//regSubmit();
		}
	}
	$("#register_form select[name='registerUserDTO.registerLevel']").change(function(){
		if($(this).val()==='L6'){
			alert("Landgrave card is not available for purchase, please choose another level!\n伯爵卡暂不可购买，请选择其他级别！")
			$(this).val('L1');
		}
	});
	$('#registerLocation_aArea').click(function(){
		$('#reg_contactNo').val('');
		$('#registerLocation').val('aArea');
	});
	$('#registerLocation_bArea').click(function(){
		$('#reg_contactNo').val('');
		$('#registerLocation').val('bArea');
	});
	
	
	$('#reg_recommendUser').bind('blur',function(){
		$('#reg_contactNo').val('');
	});
	
	
	$('#reg_recommendUser').bind('blur',function(){
		$('#reg_contactNo').val('');
	});
	if( "${param.src}" === "unfinished"){
		var tips = '您的资料尚未完善，请先完善后进行再其他操作';
		//$("#tips_text").text( tips );
	}
	$("#btnSubmitInfo").click(function(){
		if( submitCheck() ){
			//alert('OK');
			var _frm = $('#registerInfo_form').serialize();
			 $.post('registerUser!saveRegisterUserAuth.action',_frm+'&registerUserDTO.authType=NotAuthLoginName',function(res){
				 if(res=='success'){
					 $("#registerInfo_form").submit();
				 }else{
					 if(res=='loginNameExist')
						 alert('会员编号已存在!');
					 if(res=='recommendUserNotExist')
						 alert('推荐人编号不存在!');
					 if(res=='RecommendUserNotActivation')
						 alert('推荐人未激活，不允许推荐注册!');
					 if(res=='contactNoNotExist')
						 alert('接点人编号不存在!');
					 if(res=='contactNoNotActivation')
						 alert('接点人未激活，不允许注册下一层会员!');
					 if(res=='declarationCenterUserNotExist')
						 alert('运营中心不存在!');
					 if(res=='ABCAreaFull')
						 alert('左右区已满!');
					 if(res=='aAreaExist')
						 alert('左区已注册!');
					 if(res=='bAreaExist')
						 alert('右区已注册!');
					 if(res=='aAreaNotExistNotAllowRegBArea')
						 alert('左区未注册，右区不允许注册!');
					 if(res=='cAreaExist')
						 alert('C区已注册!');
					 if(res=='abAreaNotExistNotAllowRegCArea')
						 alert('AB区未注册满，还不能注册C区!');
					 if(res=='cAreaOnlyAllowsOneselfReg')
						 alert('C区只能由自己注册!');
					 if(res=='MyNotRecommedLeftArea')
						 alert('先注册左区并开通才允许注册!');
					 if(res=='staticMoneyNotEnough')
						 alert('注册失败，子账户余额不足!');
				 }
			 });
		}
	});
});	


</script>
</body>
</html>